package com.lifesaftypower.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.lifesaftypower.activity.R;
import com.lifesaftypower.product.Product;

public class ProductModelAdapter extends ArrayAdapter<Product> {
	private ArrayList<Product> _items;

	public ProductModelAdapter(Context context, int textViewResourceId,
			ArrayList<Product> items) {
		super(context, textViewResourceId, items);
		_items = items;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) { 
		View v = convertView;
		
		if (v == null) {
			LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
					Context.LAYOUT_INFLATER_SERVICE);
			v = vi.inflate(R.layout.product_list_item, null);
		}
		
		Product product = _items.get(position);
		/*
		if (product != null) {
			TextView modelName = (TextView) v
					.findViewById(R.id.tvModelName);

			if (modelName != null) {
				modelName.setText(product.get_model());
			}

			TextView size = (TextView) v
					.findViewById(R.id.tvSize);

			if (size != null) {
				size.setText(product.get_size());
			}
		}
		*/
		return v;
	}
}
